###
 # @Company: TWL
 # @Author: xue jian
 # @Email: xuejian@kanzhun.com
 # @Date: 2020-06-20 10:54:42
### 
database_name=arc
# table_name=bossrec_sample
table_name=geekrec_sample
# recall_stg_tag标注的是recall的类型。

main(){
    day=$1
    check_dianzhang2 $day
}

check_dianzhang(){
    day=$1
    sql="use $database_name;
    set mapreduce.job.queuename=boss.arc.six.vip;
    create TEMPORARY table arc_six_dev.tmp_arc_six as
    select recall_stg_tag from $table_name where ds='$day'
    and friend_source='1';
    select recall_stg_tag, count(*) from arc_six_dev.tmp_arc_six group by recall_stg_tag order by recall_stg_tag;"

    hive -e "${sql}" > ./dianzhang_result

}

check_dianzhang2(){
    day=$1
    sql="use $database_name;
    select recall_stg_tag, friend_source, count(*) from $table_name where ds ='$day' group by recall_stg_tag, friend_source;"

    hive -e "${sql}" > ./dianzhang_result

}

main $1